import 'package:flutter/material.dart';


class CandyRulesPage extends StatelessWidget {
  const CandyRulesPage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final size =MediaQuery.of(context).size;
    final width =size.width;
    final texts = [
      '1. The free spin is available for all Fortune Pay app users. Each user is automatically eligible for "one" free spin each day within the specific Fortune Wheel date period only.',
      '2. If the user did not use their free spin on that day, the unused free spin will not be added on the next day.',
      '3. Users will get free spin each day available for 24 hours (1 day) within the Fortune Wheel date period only.',
      'The Fortune Wheel will give the user their next free spin after the day ends.',
      '4. User can only collect their prize once their account is verified. The winners of e-money will have the e-money deposited on their FP wallet.',
      '5. The user will only win the specific prize where the arrow specifically pointed within the Fortune Wheel.',
      '6. To claim won products or item-type of prizes, the user shall enter their details to get the prize. The product or item will be sent in the provided delivery address.',
      '7. User can view their winnings at the Winning records side menu of the app however if f the user will give up the free gift it will not be shown in the winning records.',
      '8. The user will get another free spin once the user top-up their FP wallet with more than 500.',
    ];

    final widgets = <Widget>[];
    texts.forEach((element) {
      double top = 0;
      if(element == texts.first){
        top = 30;
      }
      widgets.add(
        Container(
          padding: EdgeInsets.only(left: 20,right: 20, bottom: 20,top: top),
          child: Text(element,
            strutStyle: StrutStyle(forceStrutHeight: true,height:0.6, leading: 0.9),
            style: TextStyle(fontSize: 12,fontFamily: 'Open Sans',color: Color(0xFF3A3A3A)),
          ),
        ),
      );
    });
    widgets.add(SizedBox(height: 50,));
    return Container(
      margin: EdgeInsets.only(left: 21,right: 21,top: 137,bottom: 150),
      color: Colors.white,
      child: Stack(
        children: [
          Positioned(
            top: 0,
            left: 0,
            right: 0,
            height: 45.0,
            child: Container(
              color: Color(0xFF041D57),
              alignment: Alignment.center,
              child: Center(
                child: Text('Rules', textAlign: TextAlign.center, style: TextStyle(color: Colors.white, fontSize: 14,fontFamily: 'Avenir Next LT Pro',),),
              ),
            ),
          ),
          Positioned(
            top: 45.0,
            left: 0,
            right: 0,
            bottom: 100,
            child: SingleChildScrollView(
              child: Column(
                children: widgets,
              ),
            ),
          ),
          Positioned(
            left: (width - 21*2 - 20*2 - 184)/2,
            right: (width - 21*2 - 20*2 - 184)/2,
            height: 34.0 + 40,
            bottom: 0,
            child: Container(
              child: InkWell(
                onTap: ()=> Navigator.of(context).pop(),
                child: 
                  Container(
                    height: 34,
                    margin: EdgeInsets.only(bottom: 40),
                    decoration: BoxDecoration(
                      color: Color(0xFFFFB32C),
                      borderRadius: BorderRadius.circular(17),
                    ),
                    child: Center(
                      child: Text('Confirm', style: TextStyle(color: Color(0xFFFFFFFF), fontSize: 14,fontFamily: 'Avenir Next LT Pro',fontWeight: FontWeight.bold),),
                    ),
                  ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}